package cn.doitedu;

import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.BytesWritable;
import org.roaringbitmap.longlong.Roaring64Bitmap;

import java.io.IOException;

public class BitmapGetCardinality extends UDF {

    public long evaluate(BytesWritable bmBytes) throws IOException {
        Roaring64Bitmap bm = AggBigIntToBitmap.SerDe.de(bmBytes.getBytes());
        return bm.getLongCardinality();
    }


}
